import {request} from '../utils/request'

export const getChannelAPI = ()=> {
    return request({
        url:'/channels',
        method:'GET',
    })
}

export const createArticleAPI = (data)=> {
    return request({
        url:'/mp/articles?draft=false',
        method:'POST',
        data
    })
}

export const getArticleAPI = (params)=> {
    return request({
        url:'/mp/articles',
        method:'GET',
        params
    })
}

export const delArticleAPI = (id)=> {
    return request({
        url:`/mp/articles/${id}`,
        method:'DELETE'
    })
}

export const getArticleById = (id)=> {
    return request({
        url:`/mp/articles/${id}`,
    })
}

export const updateArticleAPI  = (data)=> {
    return request({
        url:`/mp/articles/${data.id}?draft=false`,
        method:'PUT',
        data
    })
}